(include "class/obj/class.inc")
(include "class/error/class.inc")
(include "class/list/class.inc")

(def-class 'lisp 'obj)
(dec-method :vtable 'class/lisp/vtable)
(dec-method :create 'class/lisp/create :static '(r0 r1 r2) '(r0))
(dec-method :init 'class/lisp/init :static '(r0 r1 r2 r3 r4))
(dec-method :deinit 'class/lisp/deinit :final)

(dec-method :env_push 'class/lisp/env_push :static '(r0) '(r0))
(dec-method :env_pop 'class/lisp/env_pop :static '(r0) '(r0))
(dec-method :env_bind 'class/lisp/env_bind :static '(r0 r1 r2) '(r0 r1))
(dec-method :env_args_set 'class/lisp/env_args_set :static '(r0 r3 r5))
(dec-method :env_args_sig 'class/lisp/env_args_sig :static '(r1 r3 r4) '(r2))
(dec-method :env_args_type 'class/lisp/env_args_type :static '(r1 r3 r4) '(r2))
(dec-method :env_args_match 'class/lisp/env_args_match :static '(r1 r3 r4) '(r2))

(dec-method :read 'class/lisp/read :static '(r0 r1 r2) '(r0 r1 r2))
(dec-method :read_char 'class/lisp/read_char :static '(r0 r1 r2) '(r0 r1))
(dec-method :read_rmacro 'class/lisp/read_rmacro :static '(r0 r1 r2 r3) '(r0 r1 r2))
(dec-method :read_list 'class/lisp/read_list :static '(r0 r1 r2) '(r0 r1 r2))
(dec-method :read_sym 'class/lisp/read_sym :static '(r0 r1 r2) '(r0 r1 r2))
(dec-method :read_str 'class/lisp/read_str :static '(r0 r1 r2) '(r0 r1 r2))
(dec-method :read_num 'class/lisp/read_num :static '(r0 r1 r2) '(r0 r1 r2))

(dec-method :repl_eval 'class/lisp/repl_eval :static '(r0 r1) '(r0 r1))
(dec-method :repl_eval_list 'class/lisp/repl_eval_list :static '(r0 r1) '(r0 r1))
(dec-method :repl_apply 'class/lisp/repl_apply :static '(r0 r1 r2) '(r0 r1))
(dec-method :repl_print 'class/lisp/repl_print :static '(r0 r1 r2) '(r0))
(dec-method :repl_expand 'class/lisp/repl_expand :static '(r0 r1) '(r0))
(dec-method :repl_error 'class/lisp/repl_error :static '(r0 r1 r2 r3) '(r0 r1))

(dec-method :lisp_ffi 'class/lisp/lisp_ffi :static '(r0 r1) '(r0 r1))
(dec-method :lisp_prebind 'class/lisp/lisp_bindfun :static '(r0 r1) '(r0 r1))
(dec-method :lisp_macroexpand 'class/lisp/lisp_macroexpand :static '(r0 r1) '(r0 r1))
(dec-method :lisp_lambda 'class/lisp/lisp_lambda :static '(r0 r1) '(r0 r1))
(dec-method :lisp_quote 'class/lisp/lisp_quote :static '(r0 r1) '(r0 r1))
(dec-method :lisp_qquote 'class/lisp/lisp_qquote :static '(r0 r1) '(r0 r1))
(dec-method :lisp_eql 'class/lisp/lisp_eql :static '(r0 r1) '(r0 r1))
(dec-method :lisp_cond 'class/lisp/lisp_cond :static '(r0 r1) '(r0 r1))
(dec-method :lisp_progn 'class/lisp/lisp_progn :static '(r0 r1) '(r0 r1))
(dec-method :lisp_while 'class/lisp/lisp_while :static '(r0 r1) '(r0 r1))
(dec-method :lisp_print 'class/lisp/lisp_print :static '(r0 r1) '(r0 r1))
(dec-method :lisp_prin 'class/lisp/lisp_prin :static '(r0 r1) '(r0 r1))
(dec-method :lisp_copy 'class/lisp/lisp_copy :static '(r0 r1) '(r0 r1))
(dec-method :lisp_apply 'class/lisp/lisp_apply :static '(r0 r1) '(r0 r1))
(dec-method :lisp_repl 'class/lisp/lisp_repl :static '(r0 r1) '(r0 r1))
(dec-method :lisp_eval 'class/lisp/lisp_eval :static '(r0 r1) '(r0 r1))
(dec-method :lisp_throw 'class/lisp/lisp_throw :static '(r0 r1) '(r0 r1))
(dec-method :lisp_catch 'class/lisp/lisp_catch :static '(r0 r1) '(r0 r1))
(dec-method :lisp_bind 'class/lisp/lisp_bind :static '(r0 r1) '(r0 r1))
(dec-method :lisp_read 'class/lisp/lisp_read :static '(r0 r1) '(r0 r1))
(dec-method :lisp_type 'class/lisp/lisp_type :static '(r0 r1) '(r0 r1))

(dec-method :run 'class/lisp/run)

(def-struct 'lisp 'obj)
	;this first block of ptrs gets derefed on deinit
	(ptr 'stdin 'stdout 'stderr 'environment 'sym_underscore 'sym_optional
		'sym_rest 'sym_nil 'sym_t 'sym_lambda 'sym_macro 'sym_quote 'sym_qquote
		'sym_unquote 'sym_splicing 'sym_stream_name 'sym_stream_line 'sym_file_includes
		'sym_ffi)
	(ptr 'stack)
	(ulong 'nextsym)
(def-struct-end)
